/* chart-styles.css - 图表功能样式 */
.mermaid-chart {
  margin: 1rem 0;
  text-align: center;
  overflow: auto;
  padding: 1rem;
  border-radius: 8px;
  background-color: transparent; /* 修改默认背景为透明 */
}

/* 添加以下缺失的样式 */
.dark .mermaid-chart {
  background-color: transparent; /* 修改暗色主题背景为透明 */
}

/* 修改蓝色主题下Mermaid图表背景为透明 */
.blue .mermaid-chart {
  background-color: transparent;
}

/* 添加紫色主题和绿色主题的Mermaid图表背景为透明 */
.purple .mermaid-chart,
.green .mermaid-chart {
  background-color: transparent;
}

.mermaid-error {
  color: #f44336;
  padding: 1rem;
  border: 1px solid #f44336;
  border-radius: 4px;
  margin: 1rem 0;
  font-family: monospace;
}

/* 图表容器 */
.chart-container {
  position: relative;
  display: inline-block;
  z-index: 10003; /* 确保容器z-index足够高 */
}

/* 图表按钮样式 */
.chart-btn {
  padding: 0.3rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.chart-btn:hover {
  background-color: rgba(220, 220, 220, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 图表下拉菜单 */
.chart-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  z-index: 10003;
  min-width: 140px;
  margin-top: 4px;
  overflow: hidden;
  list-style: none;
  padding: 0;
  margin: 4px 0 0 0;
  
  /* 优化动画 - 仅使用transform和opacity，GPU加速 */
  opacity: 0;
  transform: translateY(-8px);
  transform-origin: top right;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  pointer-events: none;
  will-change: transform, opacity;
}

/* 显示状态动画 - 简化效果 */
.chart-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 列表项动画 - 简化并优化 */
.chart-dropdown li {
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  will-change: transform, opacity;
}

.chart-dropdown.show li {
  opacity: 1;
  transform: translateX(0);
}

/* 列表项依次出现 - 减少延迟时间 */
.chart-dropdown.show li:nth-child(1) { transition-delay: 0.02s; }
.chart-dropdown.show li:nth-child(2) { transition-delay: 0.04s; }
.chart-dropdown.show li:nth-child(3) { transition-delay: 0.06s; }
.chart-dropdown.show li:nth-child(4) { transition-delay: 0.08s; }
.chart-dropdown.show li:nth-child(5) { transition-delay: 0.1s; }
.chart-dropdown.show li:nth-child(6) { transition-delay: 0.12s; }

.chart-dropdown li a {
  display: block;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  border: none;
  outline: none;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.chart-dropdown li a:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: #667eea;
  box-shadow: 0 0 16px rgba(102, 126, 234, 0.4);
  transform: translateY(-1px);
}

.chart-dropdown li a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.chart-dropdown li a:hover::before {
  opacity: 1;
  animation: shimmer 2s ease-in-out infinite;
}

.chart-dropdown li a:focus {
  outline: none;
}

/* 主题适配 - 图表按钮 */
.dark .chart-btn,
.blue .chart-btn,
.purple .chart-btn {
  background-color: rgba(50, 50, 50, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.green .chart-btn {
  background-color: rgba(230, 255, 230, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #333;
}

.dark .chart-btn:hover,
.blue .chart-btn:hover,
.purple .chart-btn:hover {
  background-color: rgba(70, 70, 70, 0.9);
}

.green .chart-btn:hover {
  background-color: rgba(200, 255, 200, 0.9);
}

/* 主题适配 - 图表下拉菜单 */
.dark .chart-dropdown {
  background: rgba(30, 30, 30, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.dark .chart-dropdown.show {
  opacity: 1;
  transform: translateY(0);
}

.dark .chart-dropdown li a {
  color: #e0e0e0;
}

.dark .chart-dropdown li a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.3);
}

.blue .chart-dropdown {
  background: rgba(240, 248, 255, 0.98); /* 更浅的蓝色背景 */
  border-color: rgba(255, 255, 255, 0.08);
}

.blue .chart-dropdown.show {
  opacity: 1;
  transform: translateY(0);
}

.blue .chart-dropdown li a {
  color: #008fd7;
}

.blue .chart-dropdown li a:hover {
  background-color: rgba(33, 149, 243, 0.062); /* 使用更明显的蓝色悬浮背景 */
  color: #0c7edcda;
  box-shadow: 0 0 16px rgba(33, 150, 243, 0.4);

}

.purple .chart-dropdown {
  background: rgba(248, 240, 255, 0.98);
  border-color: rgba(156, 39, 176, 0.08);
}

.purple .chart-dropdown.show {
  opacity: 1;
  transform: translateY(0);
}

.purple .chart-dropdown li a {
  color: #6a1b9a;
}

.purple .chart-dropdown li a:hover {
  background-color: rgba(156, 39, 176, 0.05);
  color: #9c27b0;
  box-shadow: 0 0 16px rgba(156, 39, 176, 0.4);
}

.green .chart-dropdown {
  background: rgba(245, 255, 245, 0.98);
  border-color: rgba(76, 175, 80, 0.08);
}

.green .chart-dropdown.show {
  opacity: 1;
  transform: translateY(0);
}

.green .chart-dropdown li a {
  color: #2e7d32;
}

.green .chart-dropdown li a:hover {
  background-color: rgba(76, 175, 80, 0.05);
  color: #4caf50;
  box-shadow: 0 0 16px rgba(76, 175, 80, 0.4);
}